package cn.wolfcode.wolf2w.util;

import cn.wolfcode.wolf2w.exception.LogicException;
import org.springframework.util.StringUtils;

public class AsserUtil {
    //私有化构造器
    private AsserUtil(){}

    //对注册的参数进行判空
    public static void isLength(String key,String msg){
        if (!StringUtils.hasLength(key)){
            throw new LogicException(msg);
        }
    }

    //两次密码的判断
    public static void isEquals(String password,String rpassword,String msg){
        if (password == null || rpassword == null){
            throw new LogicException("密码不能为空");
        }
        if (!password.equals(rpassword)){
            throw new LogicException(msg);
        }
    }
}
